package com.hongyuan.sellfitness.ui.main.view_mode;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.main.beans.CoachImgBean;

public class CoachImgItemViewModel extends ItemViewModel<CoachImgViewModel> {

    public ObservableField<CoachImgBean.ListBean> entity = new ObservableField<>();

    public CoachImgItemViewModel(@NonNull CoachImgViewModel viewModel, CoachImgBean.ListBean string) {
        super(viewModel);
        entity.set(string);
    }

    //查看大图
    public BindingCommand lookBigImg = new BindingCommand(() -> {
        viewModel.uc.goLookImg.setValue(viewModel.getPosition(this));
    });

    //选中，取消选中
    public BindingCommand select = new BindingCommand(() -> {
        if(entity.get().isSelect()){
            entity.get().setSelect(false);
        }else{
            entity.get().setSelect(true);
        }

        entity.notifyChange();
    });
}
